﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Controller;
using Interfaces;

namespace GUI
{
    public partial class FrmFakturaRap : Form
    {
        // attributter
        EmmaSystem system;
        int fakturaNr;

        // konstruktør
        public FrmFakturaRap(EmmaSystem system, int fakturaNr)
        {
            InitializeComponent();

            this.system = system;
            this.fakturaNr = fakturaNr;
        }

        // form load hændelse
        private void FrmFakturaRap_Load(object sender, EventArgs e)
        {
            system.UdregnTalTilFaktura(fakturaNr);
            system.UdfyldIFaktura(fakturaNr);
            system.UdfyldIVarer(fakturaNr);

            this.EmmaSystemBindingSource.DataSource = system.IVarer;
            this.EmmaSystemBindingSource.DataSource = system.IFaktura;
            this.rpvFaktura.RefreshReport();
        }

        // luk-knappen
        private void btnLuk_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        // send-knappen
        private void btnSend_Click(object sender, EventArgs e)
        {
            FrmSendEmail frmSendMail = new FrmSendEmail(system, rpvFaktura);
            this.Hide();
            frmSendMail.ShowDialog();
            this.Show();
        }
    }
}
